package com.llf.Controller;

import com.llf.Pojo.Department;
import com.llf.Service.DepartmentService;
import com.llf.Service.DepartmentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;

@Controller
public class ControllerDept {
    @Autowired
    private DepartmentServiceImpl departmentService;
    @GetMapping("/todept")
    public String todept(Model model){
        ArrayList<Department> departments = departmentService.getall();
        model.addAttribute("depts",departments);
        return "department";
    }
}
